package bookmanagementsystem.model;

import java.sql.Timestamp;

public class BorrowingRecord {
    private String recordID;
    private String userID;
    private String bookID;
    private Timestamp borrowingTime;
    private Timestamp expectedReturnTime;

    // 常用构造函数，传入必要信息并生成记录ID、设置借阅时间和预计归还时间（这里假设借阅期限为30天，可调整）
    public BorrowingRecord(String userID, String bookID, Timestamp borrowingTime, Timestamp expectedReturnTime) {
        this.userID = userID;
        this.bookID = bookID;
        this.borrowingTime = borrowingTime;
        this.expectedReturnTime = expectedReturnTime;
        this.recordID = "borrow_" + System.currentTimeMillis();
    }

    // 重载构造函数，用于从数据库查询结果构建对象时使用（已有记录ID的情况）
    public BorrowingRecord(String recordID, String userID, String bookID, Timestamp borrowingTime, Timestamp expectedReturnTime) {
        this.recordID = recordID;
        this.userID = userID;
        this.bookID = bookID;
        this.borrowingTime = borrowingTime;
        this.expectedReturnTime = expectedReturnTime;
    }

    // 获取记录ID的方法
    public String getRecordID() {
        return recordID;
    }

    // 设置记录ID的方法
    public void setRecordID(String recordID) {
        this.recordID = recordID;
    }

    // 获取用户ID的方法
    public String getUserID() {
        return userID;
    }

    // 设置用户ID的方法
    public void setUserID(String userID) {
        this.userID = userID;
    }

    // 获取图书ID的方法
    public String getBookID() {
        return bookID;
    }

    // 设置图书ID的方法
    public void setBookID(String bookID) {
        this.bookID = bookID;
    }

    // 获取借阅时间的方法
    public Timestamp getBorrowingTime() {
        return borrowingTime;
    }

    // 设置借阅时间的方法
    public void setBorrowingTime(Timestamp borrowingTime) {
        this.borrowingTime = borrowingTime;
    }

    // 获取预计归还时间的方法
    public Timestamp getExpectedReturnTime() {
        return expectedReturnTime;
    }

    // 设置预计归还时间的方法
    public void setExpectedReturnTime(Timestamp expectedReturnTime) {
        this.expectedReturnTime = expectedReturnTime;
    }
}